﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Ken_WPF_UI.View
{
    /// <summary>
    /// TreeViewWindow.xaml 的交互逻辑
    /// </summary>
    public partial class TreeViewWindow : Window
    {
        public TreeViewWindow()
        {
            InitializeComponent();
        }

        private void treeView1_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
        {
            TreeViewItem treeViewItem = e.NewValue as TreeViewItem;

            //MessageBox.Show(treeViewItem.Header.ToString());
        }

        private void TreeViewItem_Selected(object sender, RoutedEventArgs e)
        {
          
            TreeViewItem mainTreeViewItem = sender as TreeViewItem;
            //触发者
            TreeViewItem treeViewItem = e.OriginalSource as TreeViewItem;
            //MessageBox.Show($"顶部：{mainTreeViewItem.Header.ToString()},触发者:{treeViewItem.Header.ToString()}");
        }

        private void Label_MouseDown(object sender, MouseButtonEventArgs e)
        {
            TreeViewWindow2 tree = new TreeViewWindow2();
            tree.Owner = this;
            tree.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            tree.Show();
        }
    }
}
